package com.hnx.admin.common.security.fliter;

import com.hnx.admin.api.security.api.VerifySystem;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

import java.io.IOException;

/*
创建人： 倔强的头发
创建时间：2024/7/5
功能描述:

*/
@Component
@RequiredArgsConstructor
public class JwtAuthenticationFilter  extends OncePerRequestFilter {
    private final VerifySystem verifySystem;
    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
        if(verifySystem.verify(request,response)) {
            filterChain.doFilter(request, response);
        }

    }
}
